magmafandomcom-20200223-history
Classes
Classes represent Objects that can be used by your plugin. Many of them are parameters of the hook functions, so are important to be familiar with. Entity Methods Entity.Destroy():void Entity.GetTakeDamage():TakeDamage Entity.IsDeployableObject():bool Entity.IsStructure():bool Entity.SetDecayEnabled(bool c):void Entity.UpdateHealth():void Entity.ChangeOwner(Player p) Will only work with DeployableObjects (Doors, Bench, Bed, etc...) Properties Entity.Name:string Entity.OwnerID:ulong Entity.X:float Entity.Y:float Entity.Z:float Entity.InstanceID:int Entity.CreatorID:ulong Entity.Creator:Player Entity.Owner:Player NPC Methods NPC.Kill():void Properties NPC.Character:Character NPC.Health:float NPC.Name:string NPC.Location:UnityEngine.Vector3 NPC.X:float NPC.Y:float NPC.Z:float Player Methods Player.Disconnect():void Player.Find(string search):Player Player.FindByName(string name):Player Player.FindByGameID(string uid):Player Player.FindByNetworkPlayer(uLink.NetworkPlayer np):Player Player.FindByPlayerClient(PlayerClient pc):Player Player.FindBySteamID(string uid):Player Player.InventoryNotice(string arg):void Player.Kill():void Player.Message(string arg):void Player.MessageFrom(string playername, string arg):void Player.Notice(string arg):void Player.Notice(string icon, string text, float duration = 4f):void Player.SendCommand(string cmd):void Will send client commands to the player like "grass.on false" Player.TeleportTo(Player p):void Player.TeleportTo(float x, float y, float z):void Properties Player.Admin:bool Player.GameID:string Player.Health:float Player.Inventory:PlayerInventory Player.IP:string Player.IsBleeding:bool Player.IsCold:bool Player.IsInjured:bool Player.Location:UnityEngine.Vector3 Player.Name:string <---в версии 1.1.5 прерывает выполнение кода (не работает) / if executed, terminated code, not work! Player.Ping:int Player.PlayerClient:PlayerClient Player.SteamID:string Player.TimeOnline:long (elapsed session time in milliseconds) Player.X:float Player.Y:float Player.Z:float Player Inventory Methods PlayerInventory.AddItem(string name):void PlayerInventory.AddItem(string name, int amount):void Player.Inventory.AddItemTo(string name, int number):void Player.Inventory.AddItemTo(string name, int slot, int amount):void PlayerInventory.Clear():void PlayerInventory.ClearAll():void PlayerInventory.ClearArmor():void PlayerInventory.ClearBar():void PlayerInventory.DropAll():void PlayerInventory.DropItem(int slot):void PlayerInventory.DropItem(PlayerItem pi):void PlayerInventory.HasItem(string name, int number):bool PlayerInventory.HasItem(string name):bool Player.Inventory.MoveItem(int s1, int s2):void PlayerInventory.RemoveItem(PlayerItem pi):void PlayerInventory.RemoveItem(string name, int number):void PlayerInventory.RemoveItem(int slot):void Player.Inventory.RemoveItemAll(string name):void With only the item name as argument will delete all the items found with that name. Properties PlayerInventory.ArmorItems:PlayerItem[] PlayerInventory.BarItems:PlayerItem[] PlayerInventory.FreeSlots:int PlayerInventory.InternalInventory:Inventory PlayerInventory.Items:PlayerItem[] Player Item Methods PlayerItem.Consume(int qty):void PlayerItem.Drop():void PlayerItem.IsEmpty():bool PlayerItem.TryCombine(PlayerItem pi):bool PlayerItem.TryStack(PlayerItem pi):bool Properties PlayerItem.InventoryItem:IInventoryItem PlayerItem.Name:string PlayerItem.Quantity:int PlayerItem.Slot:int PlayerItem.UsesLeft:int Plugin Methods Plugin.CreateDir(string name):bool Plugin.CreateIni(string name):IniParser Plugin.CreateTimer(string name, int timeoutDelay):TimedEvent Plugin.CreateTimer(string name, int timeoutDelay, ParamList args):TimedEvent Plugin.DeleteLog(string file):void Plugin.GetDate():string Plugin.GetIni(string name):IniParser Plugin.GetInis(string name):List Plugin.GetTicks():int Plugin.GetTime():string Plugin.GetTimer(string name):TimedEvent Plugin.GetTimestamp():long Plugin.IniExists(string name):bool Plugin.KillTimer(string name):void Plugin.KillTimers():void Plugin.Log(string file,string text):void Properties Plugin.Code:string Plugin.Commands:ArrayList Plugin.Path:string Server Methods Server.Broadcast(string arg):void Server.BroadcastNotice(string s):void Server.BroadcastFrom(Name, Text) Server.FindPlayer(String) String can be exact PlayerName, SteamID or GameID Server.Save():void Properties Server.ChatHistoryMessages:List Server.ChatHistoryUsers:List Server.Items:ItemsBlocks Server.Players:List Server.ServerStructures:StructureMaster Utilities Methods Util.ConsoleLot(string str, bool adminOnly):void Util.CreateArrayInstance(string name, int size):object Util.CreateInstance(string name, params object[] args):object Util.CreateQuat(float x,float y, float z, floatw):UnityEngine.Quaternion Util.CreateVector(float x,float y, float z,):UnityEngine.Vector3 Util.DestroyObject(GameObject) Will simply kill the specified GameObject Instance. Util.GetAbsoluteFilePath(string fileName):string Util.GetMagmaFolder():string Util.GetRootFolder():string Util.GetRustPPDirectory():string Util.GetServerFolder():string Util.GetUtil():Util Util.GetVectorsDistance(UnityEngine.Vector3 v1, UnityEngine.Vector3 v2):float Util.GetStaticField(string className, string field):object Util.HashtableFromFile(string path):Hashtable Util.HashtableToFile(Hashtable ht, string path):void Util.Infront(Player, Length) Will return a Vector3 Object containing the coords infront of the specified Player. Util.InvokeStatic(string className, string method, params object[] args):object Util.IsNull(object obj):bool Util.Log(string str):void Util.Regex(string input, string match):Match Util.RotateX(Quaternion q, float angle):quaternion Util.RotateY(Quaternion q, float angle):quaternion Util.RotayeZ(Quaternion q, float angle):quaternion Util.say(uLink.NetworkPlayer player, string playername, string arg):void Util.sayAll(string arg):void Util.sayUser(uLink.NetworkPlayer player, string arg):void Util.sayUser(uLink.NetworkPlayer player, string customName, string arg):void Util.SetStaticField(string className, string field, object val):void Util.TryFindType(string typeName, out Type t):bool Web Methods Web.GET(string url):string Web.POST(string url, string data):string World Methods World.Airdrop():void World.Airdrop(int rep):void World.AirdropAt(float x, float y, float z):void World.AirdropAt(float x, float y, float z, int rep):void World.AirdropAtPlayer(Player p):void World.AirdropAtPlayer(Player p, int rep):void World.Blocks():void World.GetWorld():World World.Lists():void World.Spawn(string prefab, UnityEngine.Vector3 location, int rep):void World.Spawn(string prefab, float x, float y, float z, int rep):void World.Spawn(string prefab, float x, float y, float z):void World.Spawn(string prefab, UnityEngine.Vector3 location):void World.SpawnAtPlayer(string prefab, Player p):void World.SpawnAtPlayer(string prefab, Player p, int rep):void World.CreateZone(string name):Zone3D World.CreateSM(Player):StructureMaster object with the Player as the owner. World.CreateSM(Player, float x, float y, float z):StructureMaster object with the Player as the owner. World.CreateSM(Player p, float x, float y, float z, Quaternion rot):StructureMaster object with the Player as the owner. World.GetGround(float x, float z):float (Return the height of the ground on the map at the specified (X, Z) point.) Properties World.DayLength:float World.NightLength:float World.Time:float World.Entities:List DeathEvent Properties DeathEvent.DropItems:bool DeathEvent.Attacker:Player DeathEvent.DamageAmount:float DeathEvent.DamageEvent:DamageEvent DeathEvent.Entity:Entity DeathEvent.Victim:Player DeathEvent.WeaponData:WeaponImpact DeathEvent.WeaponName:string Hurtevent Properties HurtEvent.Attacker:Player HurtEvent.DamageAmount:float HurtEvent.DamageEvent:DamageEvent HurtEvent.Entity:Entity HurtEvent.Victim:Player HurtEvent.WeaponData:WeaponImpact HurtEvent.WeaponName:string HurtEvent.DamageType:string (Returns Unknown, Bleeding, Generic, Bullet, Melee, Explosion, Radiation or Cold) DecayEvent Properties DecayEvent.DamageAmount:float DecayEvent.Entity:Entity TimedEvent Methods TimedEvent.Start():void TimedEvent.Stop():void TimedEvent.TimerLeft():double Properties TimedEvent.Interval:double TimedEvent.Name:string TimedEvent.Args:ParamList